<extend name="Home@Base/common" xmlns="http://www.w3.org/1999/html"/>
<block name="body">
    <div class="span9 page_message">
        <section id="contents"> <include file="Home@Addons/_nav" />
            <div class="tab-content">
                <form class="form-horizontal form-center" method="post" action="{$post_url}" id="form">
                    <div id="info_head">
                        <table>
                            <tr>
                                <td><label class="item-label">申请单号:</label></td>
                                <td colspan="4"> <span class="check-tips">{$applyInfo.apply_no}</span></td>
                                <td><label class="item-label">创建时间:</label></td>
                                <td colspan="4"> <span class="check-tips">{$applyInfo.create_time}</span></td>
                                <td><label class="item-label">报销类型:</label></td>
                                <td><span class="check-tips">{$applyInfo.type}</span></td>
                            </tr>
                            <tr>
                                <td><label class="item-label">申请人:</label></td>
                                <td colspan="4">{$applyInfo.applyer}</td>
                                <td><label class="item-label">申请人部门:</label></td>
                                <td colspan="4">{$applyInfo.dept}</td>
                                <td><label class="item-label">职务:</label></td>
                                <td><span class="check-tips">{$applyInfo.duty}</span></td>
                            </tr>
                        </table>
                    </div>
                    <hr>
                    <if condition="$applyInfo.subtype eq 0">
                        <div id="trip">
                            <volist name="applyInfo.itinerarys" id="vo">
                                <div><label class="item-label">行程 {$vo.id}:</label></div>
                                <table>
                                    <tr style="border:0px">
                                        <td style="border:0px" colspan="2"><label class="item-label">起始日期</label></td>
                                        <td style="border:0px" colspan="2"><label class="item-label">{$vo.start_date}</label></td>
                                        <td style="border:0px" colspan="2"><label class="item-label">结束日期</label></td>
                                        <td style="border:0px" colspan="2"><label class="item-label">{$vo.end_date}</label></td>
                                        <td style="border:0px" colspan="2"><label class="item-label">总天数</label></td>
                                        <td style="border:0px" colspan="2"><label class="item-label">{$vo.days}</label></td>
                                    </tr>
                                    <tr style="border:0px">
                                        <td style="border:0px" colspan="1"><label class="item-label">出发地 </label></td>
                                        <td style="border:0px" colspan="3"><label class="item-label">{$vo.start_addr}</label></td>
                                        <td style="border:0px" colspan="1"><label class="item-label">目的地 </label></td>
                                        <td style="border:0px" colspan="3"><label class="item-label">{$vo.end_addr}</label></td>
                                        <td style="border:0px" colspan="2"><label class="item-label">人数 </label></td>
                                        <td style="border:0px" colspan="2"><label class="item-label">{$vo.people_num}</label></td>
                                    </tr>
                                </table>
                                <div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:100;width:100%;height:100%;display:none;">
                                    <div id="innerdiv" style="position:absolute;">
                                        <img id="bigimg" style="border:5px solid #fff;" src="" />
                                    </div>
                                </div>
                                <volist name="vo.items" id="item">
                                    <div class="itemdiv"><label class="item-label" style="width: 120px;">报销条目{$key+1}:</label></div>
                                    <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">条目类别:</label><label class="item-label">{$item.type}</label></div>
                                    <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">金额数:</label><label class="item-label">{$item.total} 元</label></div>
                                    <notempty name="item.standard">
                                        <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">日标准:</label><label class="item-label">{$item.standard} </label></div>
                                    </notempty>
                                    <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">发票张数:</label><label class="item-label">{$item.invoiceCount} 张</label></div>
                                    <notempty name="vo.description">
                                        <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">备  注:</label><label class="item-label">{$item.description}</label></div>
                                    </notempty>
                                    <div class="item_image_box">
                                        <volist name="item.pictures" id="pic">
                                            <img class="item_image" src={$pic} >
                                        </volist>
                                    </div>
                                    <br/>
                                </volist>
                                <hr>
                            </volist>
                         </div>
                    </if>
                    <if condition="$applyInfo.subtype eq 1">
                        <div id="meeting">
                            <div><label class="item-label">申请详细内容:</label></div>
                            <table>
                                <tr style="border:0px">
                                    <td style="border:0px" colspan="2"><label class="item-label">起始日期</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.start_date}</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">结束日期</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.end_date}</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">总天数</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.totalDays}</label></td>
                                </tr>
                                <tr style="border:0px">
                                    <td style="border:0px" colspan="2"><label class="item-label">会议培训</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.end_addr}</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">培训类别</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.trainTypeStr}</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">参会人数</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.attendance}</label></td>
                                 </tr>
                            </table>
                        </div>
                    </if>
                    <if condition="$applyInfo.subtype eq 2">
                        <div id="trip">
                            <div><label class="item-label">申请详细内容:</label></div>
                            <table>
                                <tr style="border:0px">
                                    <td style="border:0px" colspan="2"><label class="item-label">起始日期</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.start_date}</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">结束日期</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.end_date}</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">总天数</label></td>
                                    <td style="border:0px" colspan="2"><label class="item-label">{$applyInfo.details.totalDays}</label></td>
                                </tr>
                                <tr style="border:0px">
                                    <td style="border:0px" colspan="2"><label class="item-label">出发地 </label></td>
                                    <td style="border:0px" colspan="4"><label class="item-label">{$applyInfo.details.start_addr}</label></td>
                                    <td style="border:0px" colspan="3"><label class="item-label">目的地 </label></td>
                                    <td style="border:0px" colspan="3"><label class="item-label">{$applyInfo.details.end_addr}</label></td>
                                </tr>
                            </table>
                        </div>
                    </if>
                    <if condition="$applyInfo.subtype neq 0">
                        <hr>
                        <div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:100;width:100%;height:100%;display:none;">
                            <div id="innerdiv" style="position:absolute;">
                                <img id="bigimg" style="border:5px solid #fff;" src="" />
                            </div>
                        </div>
                        <div id="items">
                        <volist name="applyInfo.items" id="vo">
                            <label class="item-label">报销条目明细:</label>
                            <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">条目类别:</label><label class="item-label">{$vo.type}</label></div>
                            <notempty name="vo.price">
                                <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">单价:</label><label class="item-label">{$vo.price} 元</label></div>
                            </notempty>
                            <notempty name="vo.quantity">
                                <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">数量:</label><label class="item-label">{$vo.quantity}</label></div>
                            </notempty>
                            <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">金额数:</label><label class="item-label">{$vo.total} 元</label></div>
                            <notempty name="vo.standard">
                                <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">日标准:</label><label class="item-label">{$vo.standard} </label></div>
                            </notempty>
                            <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">发票张数:</label><label class="item-label">{$vo.invoiceCount} 张</label></div>
                            <notempty name="vo.description">
                                <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">备  注:</label><label class="item-label">{$vo.description}</label></div>
                            </notempty>
                            <div class="item_image_box">
                                <volist name="vo.pictures" id="pic">
                                    <img class="item_image" src={$pic} >
                                </volist>
                            </div>
                            <notempty name="vo.fileCount">
                                <div class="itemdiv"><label class="item-label" style="width: 120px;float: left">附件数量:</label><label class="item-label">{$vo.fileCount} 个</label></div>
                            </notempty>
                            <notempty name="vo.files">
                                <div class="itemdiv">
                                    <label class="item-label" style="width: 120px;float: left">附件:</label>
                                    <volist name="vo.files" id="f">
                                        <a href="{$f['url']}"><span class="upload_icon_all" ></span>{$f['name']}</a>
                                        <span>&nbsp&nbsp</span>
                                    </volist>
                                </div>
                            </notempty>
                            <hr>
                        </volist>
                        </div>
                    </if>
                    <div class="itemdiv">
                        <label class="item-label" style="width: 120px">总金额数:</label><label class="item-label">{$applyInfo.total_money} 元</label>
                    </div>
                    <div><label class="item-label" style="width: 100%;float: left">
                        <hr>
                        <a href="{:U(loglists, array('application_id'=>$applyInfo['id'], 'method'=>'details'))}"> <点击查看历史审批详情></a>
                        <a href="{:U(print_details, array('application_id'=>$applyInfo['id'], 'method'=>'approveApplication'))}" style="float:right;"> <点击打印审批详情></a>
                        <br>
                    </label></div>

                    <div class="order_status">
                        <volist name="applyInfo.process_bar" id="vo">
                            <span class="s-step s-step{$vo.step} {$vo.active}"><b><b></b></b>
                            <empty name="vo.last_step">
                                <p></p >
                            </empty>
                                <em>{$vo.nodeState}</em>
                                <div>{$vo.nodeName}</div>
                            </span>
                        </volist>
                    </div>
                </form>
            </div>
        </section>
    </div>
</block>
<block name="style">
    <style type="text/css">
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 0 auto;
            text-align: center;
        }
        table td, table th {
            border: 1px solid #cad9ea;
            color: #666;
            height: 30px;
            text-align: center;
        }
        table thead th {
            background-color: #CCE8EB;
            width: 100px;
        }
        table tr:nth-child(odd) {
            background: #fff;
        }
        table tr:nth-child(even) {
            background: #F5FAFA;
        }
        .itemdiv{
            display: flex;
            width: 50%;
            height: 20px;
            font-size: 14px;
            padding: 0,0,0,0;
            text-align: center;
            float: left;
            margin-bottom: 8px;
        }
        .item_image{
            width: 100px;
            height: 100px;
            float: left;
            margin-right: 10px;
            margin-bottom: 10px;
        }
        .item_image_box{
            width: 100%;
            height:auto;
            word-break: break-all;
            word-wrap: break-word;
            overflow: hidden;
        }
        #dialog_pic {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0,0,0,0.65);
            z-index: 100;
            display: none;
        .dialog-body {
            width: 100%;
            max-width: 250px;
            max-height: 300px;
            margin: 0 auto;
            padding: 10px;
            border-radius: 5px;
            background: white;
            overflow: auto;
            margin-top: 283px;
        img {
            width: 100%;
        }
        }
        }
        .button1 {
            background-color: red; /* blue re*/
            border: none;
            color: white;
            padding: 5px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 14px;
            margin-left: 100px;
            text-align: center;
            width: 120px;
        }
        .button2 {
            background-color: #00CC66; /* blue */
            border: none;
            color: white;
            padding: 5px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 14px;
            margin-left: 100px;
            text-align: center;
            width: 120px;
        }

        /*状态进度条*/
        .order_status {height:90px;padding-top: 150px;padding-left: 50px;}
        .order_status .s-step {float: left;width: 14%;height: 60px;position: relative;}
        .order_status .s-step:nth-child(7n) {width:0px;}
        .order_status .s-step.active {float: left;width: 14%;height: 60px;position: relative;}
        .order_status .s-step>b>b.active {background-color: #f2572d}
        .order_status .s-step>b {display: block;width: 32px;height:32px;line-height: 32px;border-radius: 32px;position: absolute;margin-left: -16px;top: -20px;background: #ddd;z-index: 87}
        .order_status .s-step>b>b {display: block;width: 26px;height: 26px;line-height: 26px;border-radius: 26px;background: #ccc;margin-top: 3px;margin-left: 3px;z-index: 88}
        .order_status .s-step>p {width: 120px;height: 10px;background: #ddd;top: -10px;position: absolute;z-index: 86}
        .order_status .s-step>p.active {width: 120px;height: 10px;background: #f2572c;top: -10px;position: absolute;z-index: 86}
        .order_status .s-step em {display: block;padding-top: 20px;font-style: normal;text-align: center;color: #b7b7b7;font-size: 12px;margin-left: -65px;width: 130px}
        .order_status .s-step>div {display: block;width:80px;height:32px;line-height: 32px;position: absolute;margin-left: -40px;top: -55px;z-index: 87;text-align: center;font-size: 12px;color: #c9c4c4}
        .order_status .s-step>div.active {display: block;width:80px;height:32px;line-height: 32px;position: absolute;margin-left: -40px;top: -55px;z-index: 87;text-align: center;font-size: 12px;color: #f2572c}

    </style>
</block>
<block name="script">
    <script type="text/javascript">
        $(function() {
            showTab();
            $("img.item_image").click(function(){
                var _this = $(this); // 将当前的pimg元素作为_this传入函数
                imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
            });
            processStepBar();
        });

        function imgShow(outerdiv, innerdiv, bigimg, _this){
            var src = _this.attr("src");   //获取当前点击的pimg元素中的src属性
            $(bigimg).attr("src", src);    //设置#bigimg元素的src属性

            /*获取当前点击图片的真实大小，并显示弹出层及大图*/
            $("<img/>").attr("src", src).load(function(){
                var windowW = $(window).width();  //获取当前窗口宽度
                var windowH = $(window).height();  //获取当前窗口高度
                var realWidth = this.width;  //获取图片真实宽度
                var realHeight = this.height;  //获取图片真实高度
                var imgWidth, imgHeight;
                var scale = 0.8;  //缩放尺寸，当图片真实宽度和高度大于窗口宽度和高度时进行缩放

                if(realHeight>windowH*scale) {  //判断图片高度
                    imgHeight = windowH*scale;  //如大于窗口高度，图片高度进行缩放
                    imgWidth = imgHeight/realHeight*realWidth;  //等比例缩放宽度
                    if(imgWidth>windowW*scale) {  //如宽度扔大于窗口宽度
                        imgWidth = windowW*scale;  //再对宽度进行缩放
                    }
                } else if(realWidth>windowW*scale) {  //如图片高度合适，判断图片宽度
                    imgWidth = windowW*scale;   //如大于窗口宽度，图片宽度进行缩放
                    imgHeight = imgWidth/realWidth*realHeight;  //等比例缩放高度
                } else {    //如果图片真实高度和宽度都符合要求，高宽不变
                    imgWidth = realWidth;
                    imgHeight = realHeight;
                }
                $(bigimg).css("width",imgWidth);    //以最终的宽度对图片缩放

                var w = (windowW-imgWidth)/2;   //计算图片与窗口左边距
                var h = (windowH-imgHeight)/2;  //计算图片与窗口上边距
                $(innerdiv).css({"top":h, "left":w});   //设置#innerdiv的top和left属性
                $(outerdiv).fadeIn("fast"); //淡入显示#outerdiv及.pimg
            });

            $(outerdiv).click(function(){   //再次点击淡出消失弹出层
                $(this).fadeOut("fast");
            });
        }

        function processStepBar() {
            if($(".s-step0").hasClass("active")){
                $(".s-step0>b>b,.s-step0>div").addClass("active");
                $(".s-step1>em,.s-step2>em,.s-step3>em,.s-step4>em,.s-step5>em,.s-step6>em").hide();
            }
            else if($(".s-step1").hasClass("active")){
                $(".s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");
                $(".s-step2>em,.s-step3>em,.s-step4>em,.s-step5>em,.s-step6>em").hide();
            }
            else if($(".s-step2").hasClass("active")){
                $(".s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");
                $(".s-step3>em,.s-step4>em,.s-step5>em,.s-step6>em").hide();
            }
            else if($(".s-step3").hasClass("active")){
                $(".s-step3>b>b,.s-step3>div,.s-step2>p,.s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");
                $(".s-step4>em,.s-step5>em,.s-step6>em").hide();
            }
            else if($(".s-step4").hasClass("active")){
                $(".s-step4>b>b,.s-step4>div,.s-step3>p,.s-step3>b>b,.s-step3>div,.s-step2>p,.s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");
                $(".s-step5>em,.s-step6>em").hide();
            }
            else if($(".s-step5").hasClass("active")){
                $(".s-step5>b>b,.s-step5>div,.s-step4>p,.s-step4>b>b,.s-step4>div,.s-step3>p,.s-step3>b>b,.s-step3>div,.s-step2>p,.s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");
                $(".s-step6>em").hide();
            }
            else{
                $(".s-step6>b>b,.s-step6>div,.s-step5>p,.s-step5>b>b,.s-step5>div,.s-step4>p,.s-step4>b>b,.s-step4>div,.s-step3>p,.s-step3>b>b,.s-step3>div,.s-step2>p,.s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");
            }
        }
    </script>

</block>